<?php
/**
 * Alex Snet FrameWork
 * AutoLoader  (/asf.include.php)
 * mail: me@alexsnet.ru
 * site: http://alexsnet.ru
 * phone: +7 909 962-63-18
 * date: 02 Jan 2009
 */


/*
 * DEFINES
 * {{{
 */
if(!defined('ASF_FW'))	define('ASF_FW',realpath(getcwd() . '/../Lib')); 
if(!defined('DS'))		define('DS',	DIRECTORY_SEPARATOR);
if(!defined('WIN'))		define('WIN',	(substr(PHP_OS, 0, 3)=='WIN')?1:0);
/*
 * DEFINES
 * }}}
 */


/*
 * FUNCTION __AUTOLOAD
 * {{{
 */
function __autoload($class_name)
{
	$cn = strtolower($class_name);
	if(strpos('asf_',$class_name)<0)
	{
		if(function_exists('asf_autoload')) call_user_func('asf_autoload', $class_name);
		else print('Can not find asf_autoload function for loading another packages.');
	}
	else
	{
		$cn = substr($cn,4);
		$c = explode('_',$cn);
		$init = (isset($c[1]))?$c[1]:$c[0];
		$include = ASF_FW . '/' . $c[0] . '/' . $init . '.php';
		//print $include;
		include( $include );
	}
}
/*
 * FUNCTION __AUTOLOAD
 * }}}
 */
?>